\(\int (a+i a \tan (e+f x))^m (A+B \tan (e+f x)) (c-i c \tan (e+f x))^n \, dx\) [851]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [F]
   Fricas [F]
   Sympy [F]
   Maxima [F]
   Giac [F]
   Mupad [F(-1)]

Optimal result

Integrand size = 41, antiderivative size = 150 \[ \int (a+i a \tan (e+f x))^m (A+B \tan (e+f x)) (c-i c \tan (e+f x))^n \, dx=\frac {(i A+B) (a+i a \tan (e+f x))^m (c-i c \tan (e+f x))^n}{2 f n}-\frac {2^{-1+n} (B (m-n)+i A (m+n)) \operatorname {Hypergeometric2F1}\left (m,-n,1+m,\frac {1}{2} (1+i \tan (e+f x))\right ) (1-i \tan (e+f x))^{-n} (a+i a \tan (e+f x))^m (c-i c \tan (e+f x))^n}{f m n} \]

[Out]

1/2*(I*A+B)*(a+I*a*tan(f*x+e))^m*(c-I*c*tan(f*x+e))^n/f/n-2^(-1+n)*(B*(-n+m)+I*A*(m+n))*hypergeom([m, -n],[1+m
],1/2+1/2*I*tan(f*x+e))*(a+I*a*tan(f*x+e))^m*(c-I*c*tan(f*x+e))^n/f/m/n/((1-I*tan(f*x+e))^n)

Rubi [A] (verified)

Time = 0.27 (sec) , antiderivative size = 150, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.098, Rules used = {3669, 80, 72, 71} \[ \int (a+i a \tan (e+f x))^m (A+B \tan (e+f x)) (c-i c \tan (e+f x))^n \, dx=\frac {(B+i A) (a+i a \tan (e+f x))^m (c-i c \tan (e+f x))^n}{2 f n}-\frac {2^{n-1} (B (m-n)+i A (m+n)) (1-i \tan (e+f x))^{-n} (a+i a \tan (e+f x))^m (c-i c \tan (e+f x))^n \operatorname {Hypergeometric2F1}\left (m,-n,m+1,\frac {1}{2} (i \tan (e+f x)+1)\right )}{f m n} \]

[In]

Int[(a + I*a*Tan[e + f*x])^m*(A + B*Tan[e + f*x])*(c - I*c*Tan[e + f*x])^n,x]

[Out]

((I*A + B)*(a + I*a*Tan[e + f*x])^m*(c - I*c*Tan[e + f*x])^n)/(2*f*n) - (2^(-1 + n)*(B*(m - n) + I*A*(m + n))*
Hypergeometric2F1[m, -n, 1 + m, (1 + I*Tan[e + f*x])/2]*(a + I*a*Tan[e + f*x])^m*(c - I*c*Tan[e + f*x])^n)/(f*
m*n*(1 - I*Tan[e + f*x])^n)

Rule 71

Int[((a_) + (b_.)*(x_))^(m_)*((c_) + (d_.)*(x_))^(n_), x_Symbol] :> Simp[((a + b*x)^(m + 1)/(b*(m + 1)*(b/(b*c
 - a*d))^n))*Hypergeometric2F1[-n, m + 1, m + 2, (-d)*((a + b*x)/(b*c - a*d))], x] /; FreeQ[{a, b, c, d, m, n}
, x] && NeQ[b*c - a*d, 0] &&  !IntegerQ[m] &&  !IntegerQ[n] && GtQ[b/(b*c - a*d), 0] && (RationalQ[m] ||  !(Ra
tionalQ[n] && GtQ[-d/(b*c - a*d), 0]))

Rule 72

Int[((a_) + (b_.)*(x_))^(m_)*((c_) + (d_.)*(x_))^(n_), x_Symbol] :> Dist[(c + d*x)^FracPart[n]/((b/(b*c - a*d)
)^IntPart[n]*(b*((c + d*x)/(b*c - a*d)))^FracPart[n]), Int[(a + b*x)^m*Simp[b*(c/(b*c - a*d)) + b*d*(x/(b*c -
a*d)), x]^n, x], x] /; FreeQ[{a, b, c, d, m, n}, x] && NeQ[b*c - a*d, 0] &&  !IntegerQ[m] &&  !IntegerQ[n] &&
(RationalQ[m] ||  !SimplerQ[n + 1, m + 1])

Rule 80

Int[((a_.) + (b_.)*(x_))*((c_.) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_.), x_Symbol] :> Simp[(-(b*e - a*f
))*(c + d*x)^(n + 1)*((e + f*x)^(p + 1)/(f*(p + 1)*(c*f - d*e))), x] - Dist[(a*d*f*(n + p + 2) - b*(d*e*(n + 1
) + c*f*(p + 1)))/(f*(p + 1)*(c*f - d*e)), Int[(c + d*x)^n*(e + f*x)^Simplify[p + 1], x], x] /; FreeQ[{a, b, c
, d, e, f, n, p}, x] &&  !RationalQ[p] && SumSimplerQ[p, 1]

Rule 3669

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[a*(c/f), Subst[Int[(a + b*x)^(m - 1)*(c + d*x)^(n - 1)*(A + B*x), x
], x, Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, A, B, m, n}, x] && EqQ[b*c + a*d, 0] && EqQ[a^2 + b^2, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {(a c) \text {Subst}\left (\int (a+i a x)^{-1+m} (A+B x) (c-i c x)^{-1+n} \, dx,x,\tan (e+f x)\right )}{f} \\ & = \frac {(i A+B) (a+i a \tan (e+f x))^m (c-i c \tan (e+f x))^n}{2 f n}-\frac {(a (i B (m-n)-A (m+n))) \text {Subst}\left (\int (a+i a x)^{-1+m} (c-i c x)^n \, dx,x,\tan (e+f x)\right )}{2 f n} \\ & = \frac {(i A+B) (a+i a \tan (e+f x))^m (c-i c \tan (e+f x))^n}{2 f n}-\frac {\left (2^{-1+n} a (i B (m-n)-A (m+n)) (c-i c \tan (e+f x))^n \left (\frac {c-i c \tan (e+f x)}{c}\right )^{-n}\right ) \text {Subst}\left (\int \left (\frac {1}{2}-\frac {i x}{2}\right )^n (a+i a x)^{-1+m} \, dx,x,\tan (e+f x)\right )}{f n} \\ & = \frac {(i A+B) (a+i a \tan (e+f x))^m (c-i c \tan (e+f x))^n}{2 f n}-\frac {2^{-1+n} (B (m-n)+i A (m+n)) \operatorname {Hypergeometric2F1}\left (m,-n,1+m,\frac {1}{2} (1+i \tan (e+f x))\right ) (1-i \tan (e+f x))^{-n} (a+i a \tan (e+f x))^m (c-i c \tan (e+f x))^n}{f m n} \\ \end{align*}

Mathematica [A] (verified)

Time = 1.13 (sec) , antiderivative size = 122, normalized size of antiderivative = 0.81 \[ \int (a+i a \tan (e+f x))^m (A+B \tan (e+f x)) (c-i c \tan (e+f x))^n \, dx=\frac {2^{-1+n} \left ((-i A-B) \operatorname {Hypergeometric2F1}\left (m,1-n,1+m,\frac {1}{2} (1+i \tan (e+f x))\right )+2 B \operatorname {Hypergeometric2F1}\left (m,-n,1+m,\frac {1}{2} (1+i \tan (e+f x))\right )\right ) (1-i \tan (e+f x))^{-n} (a+i a \tan (e+f x))^m (c-i c \tan (e+f x))^n}{f m} \]

[In]

Integrate[(a + I*a*Tan[e + f*x])^m*(A + B*Tan[e + f*x])*(c - I*c*Tan[e + f*x])^n,x]

[Out]

(2^(-1 + n)*(((-I)*A - B)*Hypergeometric2F1[m, 1 - n, 1 + m, (1 + I*Tan[e + f*x])/2] + 2*B*Hypergeometric2F1[m
, -n, 1 + m, (1 + I*Tan[e + f*x])/2])*(a + I*a*Tan[e + f*x])^m*(c - I*c*Tan[e + f*x])^n)/(f*m*(1 - I*Tan[e + f
*x])^n)

Maple [F]

\[\int \left (a +i a \tan \left (f x +e \right )\right )^{m} \left (A +B \tan \left (f x +e \right )\right ) \left (c -i c \tan \left (f x +e \right )\right )^{n}d x\]

[In]

int((a+I*a*tan(f*x+e))^m*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^n,x)

[Out]

int((a+I*a*tan(f*x+e))^m*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^n,x)

Fricas [F]

\[ \int (a+i a \tan (e+f x))^m (A+B \tan (e+f x)) (c-i c \tan (e+f x))^n \, dx=\int { {\left (B \tan \left (f x + e\right ) + A\right )} {\left (i \, a \tan \left (f x + e\right ) + a\right )}^{m} {\left (-i \, c \tan \left (f x + e\right ) + c\right )}^{n} \,d x } \]

[In]

integrate((a+I*a*tan(f*x+e))^m*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^n,x, algorithm="fricas")

[Out]

integral(((A - I*B)*e^(2*I*f*x + 2*I*e) + A + I*B)*(2*c/(e^(2*I*f*x + 2*I*e) + 1))^n*e^(2*I*f*m*x + 2*I*e*m +
m*log(a/c) + m*log(2*c/(e^(2*I*f*x + 2*I*e) + 1)))/(e^(2*I*f*x + 2*I*e) + 1), x)

Sympy [F]

\[ \int (a+i a \tan (e+f x))^m (A+B \tan (e+f x)) (c-i c \tan (e+f x))^n \, dx=\int \left (i a \left (\tan {\left (e + f x \right )} - i\right )\right )^{m} \left (- i c \left (\tan {\left (e + f x \right )} + i\right )\right )^{n} \left (A + B \tan {\left (e + f x \right )}\right )\, dx \]

[In]

integrate((a+I*a*tan(f*x+e))**m*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))**n,x)

[Out]

Integral((I*a*(tan(e + f*x) - I))**m*(-I*c*(tan(e + f*x) + I))**n*(A + B*tan(e + f*x)), x)

Maxima [F]

\[ \int (a+i a \tan (e+f x))^m (A+B \tan (e+f x)) (c-i c \tan (e+f x))^n \, dx=\int { {\left (B \tan \left (f x + e\right ) + A\right )} {\left (i \, a \tan \left (f x + e\right ) + a\right )}^{m} {\left (-i \, c \tan \left (f x + e\right ) + c\right )}^{n} \,d x } \]

[In]

integrate((a+I*a*tan(f*x+e))^m*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^n,x, algorithm="maxima")

[Out]

integrate((B*tan(f*x + e) + A)*(I*a*tan(f*x + e) + a)^m*(-I*c*tan(f*x + e) + c)^n, x)

Giac [F]

\[ \int (a+i a \tan (e+f x))^m (A+B \tan (e+f x)) (c-i c \tan (e+f x))^n \, dx=\int { {\left (B \tan \left (f x + e\right ) + A\right )} {\left (i \, a \tan \left (f x + e\right ) + a\right )}^{m} {\left (-i \, c \tan \left (f x + e\right ) + c\right )}^{n} \,d x } \]

[In]

integrate((a+I*a*tan(f*x+e))^m*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^n,x, algorithm="giac")

[Out]

integrate((B*tan(f*x + e) + A)*(I*a*tan(f*x + e) + a)^m*(-I*c*tan(f*x + e) + c)^n, x)

Mupad [F(-1)]

Timed out. \[ \int (a+i a \tan (e+f x))^m (A+B \tan (e+f x)) (c-i c \tan (e+f x))^n \, dx=\int \left (A+B\,\mathrm {tan}\left (e+f\,x\right )\right )\,{\left (a+a\,\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}\right )}^m\,{\left (c-c\,\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}\right )}^n \,d x \]

[In]

int((A + B*tan(e + f*x))*(a + a*tan(e + f*x)*1i)^m*(c - c*tan(e + f*x)*1i)^n,x)

[Out]

int((A + B*tan(e + f*x))*(a + a*tan(e + f*x)*1i)^m*(c - c*tan(e + f*x)*1i)^n, x)